-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 237/email report #244
Conversation
Visit the preview URL for this PR (updated for commit 002df4e): https://codeclimbersio--pr244-issue-237-email-repo-ubirspfl.web.app (expires Thu, 17 Oct 2024 01:51:43 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 3c28ab1d661a7526dc2530b2448a1aa4f88d23d4 |
|
||
await this.pulseRepo.createPulses(uniquePulses) | ||
return activitiesUtil.pulseSuccessResponse(pulsesDto.length) | ||
return pulseSuccessResponse(pulsesDto.length) |
Check failure
Code scanning / CodeQL
Type confusion through parameter tampering Critical
this HTTP request parameter
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 5 months ago
To fix the problem, we need to ensure that the pulsesDto
parameter is indeed an array of CreateWakatimePulseDto
objects before processing it. This can be done by adding a type check at the beginning of the createPulses
method. If the type check fails, we should throw an error or return a bad request response.
- Add a type check to ensure
pulsesDto
is an array ofCreateWakatimePulseDto
objects. - Modify the
createPulses
method inactivities.service.ts
to include this type check. - Ensure that the
createPulses
method returns a bad request response if the type check fails.
-
Copy modified lines R46-R48
@@ -45,4 +45,5 @@ | ||
async createPulses(pulsesDto: CreateWakatimePulseDto[]) { | ||
assert(!pulsesDto, 'pulsesDto required') | ||
assert(!Array.isArray(pulsesDto), 'Pulses must be an array') | ||
if (!Array.isArray(pulsesDto) || !pulsesDto.every(dto => dto instanceof CreateWakatimePulseDto)) { | ||
throw new Error('Invalid input: pulsesDto must be an array of CreateWakatimePulseDto objects'); | ||
} | ||
|
The Pull Request is ready
issue-123-enable-x-does-not-disable-y
Intention
With this change I intend to set some of the foundation work for the weekly report. Included some refactoring that I'll continue in another PR around establishing the new conventions for making requests to the api
Review Points
Please take extra care reviewing...
The code follows best practices
any
type usedNotes